﻿Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace SqlDataSourceVolunteerDataFilter

    Public Class MySqlDataSourceView
        Inherits System.Web.UI.WebControls.SqlDataSourceView

        Public Sub New(ByVal owner As SqlDataSource, ByVal name As String, ByVal context As HttpContext)
            MyBase.New(owner, name, context)


        End Sub

        Protected Overloads Overrides Function ExecuteSelect(ByVal arguments As DataSourceSelectArguments) As System.Collections.IEnumerable
            ProcessSelectCommand()
            Return MyBase.ExecuteSelect(arguments)
        End Function

        Protected Overridable Sub ProcessSelectCommand()

            Dim MyFilter As New MyVolunterDataFilter

            MyFilter.AppendFormat(Me.SelectCommand)

            Me.SelectCommand = MyFilter.ToString()

        End Sub


    End Class


    <DefaultProperty("Text")> _
    <ToolboxData("<{0}:SqlDataSourceVolunteerDataFilter runat=server></{0}:SqlDataSourceVolunteerDataFilter>")> _
    <ParseChildren(True)> _
    <PersistChildren(True)> _
    Public Class SqlDataSourceVolunteerDataFilter
        Inherits System.Web.UI.WebControls.SqlDataSource
        Protected Overloads Overrides Function CreateDataSourceView(ByVal viewName As String) As System.Web.UI.WebControls.SqlDataSourceView
            Return New MySqlDataSourceView(DirectCast(Me, System.Web.UI.WebControls.SqlDataSource), viewName, HttpContext.Current)
        End Function

    End Class

End Namespace
